<template>
    <hd-login :loginStyle="loginStyle" :fun="beforeLogin"></hd-login>
</template>

<script>
import { mapActions } from 'vuex'

export default {
  data () {
    return {
      loginStyle: {
        backgroundImage: 'url(https://skv4.oss-cn-hangzhou.aliyuncs.com/ji-wei/login-bg-3.png)'
      }
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo'
    ]),
    async beforeLogin () {
      let rest = await this.getUserInfo()
      if (rest.errcode === 0) {
        return true
      } else {
        this.$Message.error('获取用户信息失败')
        return false
      }
    }
  }
}
</script>
